﻿using System.Collections.Generic;
using Gp.Scripts.Core;

namespace Helpers
{
    public static class BattleHelper
    {
        /// <summary>
        /// 获得时间行动点消耗 
        /// </summary>
        /// <returns></returns>
        public static float GetTimeCostFloat(int point)
        {
            return point / 100f;
        }

        public static string GetTimeCostString(int point)
        {
            return (point / 100f).ToString("0.00");
        }
        // public static int GetTimeCost(int point)
        // {
        //     return point / 100;
        // }

        public static List<VBattleCell> GetRangeByRadius(BaseUnit source, int radius)
        {
            var cellGrid = Global.Get<BattleSystem>().CellGrid;
            return cellGrid.GetRangeByRadius(cellGrid.GetCellOfUnit(source), radius);
        }
        
        public static List<VBattleCell> GetRangeByRadius(VBattleCell source, int radius)
        {
            return Global.Get<BattleSystem>().CellGrid.GetRangeByRadius(source, radius);
        }

        public static VBattleCell GetCell(this BaseUnit self)
        {
            return Global.Get<BattleSystem>().CellGrid.GetCellOfUnit(self);
        }
    }
}